<template>
  <div class="page-detail">
    <u-parse v-if="detail.body" :content="detail.body" />
  </div>
</template>

<script lang="ts">
import Vue from 'vue'
import { getIssueDetail } from '@/api/issues'
import uParse from '@/components/uParse/wxParse.vue'
import marked from 'marked'

interface pageQuery {
  number: string
}

export default Vue.extend({
  components: {
    uParse
  },
  data() {
    return {
      detail: {},
      content: marked('# 我是大标题')
    }
  },
  onLoad(query: pageQuery) {
    this.getDetail(query.number)
  },
  methods: {
    async getDetail(number: string) {
      const data: any = await getIssueDetail(number)
      console.log(data.data)
      this.detail = {
        ...data.data,
        body: marked(data.data.body)
      }
    }
  }
})
</script>

<style lang="scss">
.page-detail {}
</style>
